88d0e47f4d15e314b9f99ad62e09df613de4a8eb,findbugs/src/java/edu/umd/cs/findbugs/detect/FormatStringChecker.java,FormatStringChecker,sawOpcode,#number#,75
Before Change
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature())
.addString(e.getConversion())
.addString(formatString)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
else if (e.getArgumentSignature().charAt(0) == '[' && e.getConversion() == 's')
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature())
.addString(Character.toString(e.getConversion()))
.addString(formatString)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
else bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_BAD_CONVERSION", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature())
.addString(e.getConversion())
.addString(formatString)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
} catch (IllegalArgumentException e) {
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_ILLEGAL", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addString(formatString)
.addSourceLine(this)
);
} catch (MissingFormatArgumentException e) {
if (e.pos < 0) {
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addString(formatString)
.addString(e.formatSpecifier)
.addSourceLine(this)
);
} else {
After Change
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature()).describe(TypeAnnotation.FOUND_ROLE)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addString(e.getFormatSpecifier()).describe(StringAnnotation.FORMAT_SPECIFIER_ROLE)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
else if (e.getArgumentSignature().charAt(0) == '[' && e.getConversion() == 's')
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature()).describe(TypeAnnotation.FOUND_ROLE)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addString(e.getFormatSpecifier()).describe(StringAnnotation.FORMAT_SPECIFIER_ROLE)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
else bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_BAD_CONVERSION", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addType(e.getArgumentSignature()).describe(TypeAnnotation.FOUND_ROLE)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addString(e.getFormatSpecifier()).describe(StringAnnotation.FORMAT_SPECIFIER_ROLE)
.addValueSource(arguments[e.getArgIndex()], getMethod(), getPC())
.addSourceLine(this)
);
} catch (IllegalArgumentException e) {
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_ILLEGAL", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addSourceLine(this)
);
} catch (MissingFormatArgumentException e) {
if (e.pos < 0) {
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addString(e.formatSpecifier).describe(StringAnnotation.FORMAT_SPECIFIER_ROLE)
.addSourceLine(this)
);
} else {
bugReporter.reportBug(
new BugInstance(this, "VA_FORMAT_STRING_MISSING_ARGUMENT", HIGH_PRIORITY)
.addClassAndMethod(this)
.addCalledMethod(this)
.addString(formatString).describe(StringAnnotation.FORMAT_STRING_ROLE)
.addString(e.formatSpecifier).describe(StringAnnotation.FORMAT_SPECIFIER_ROLE)
.addInt(e.pos+1).describe(IntAnnotation.INT_EXPECTED_ARGUMENTS)
.addInt(arguments.length).describe(IntAnnotation.INT_ACTUAL_ARGUMENTS)
.addSourceLine(this)
);